define(['./../initial'], function() {
    var app = angular.module('App.tool');
    app.directive('fullScreenModal', ['$rootScope', '$q', function($rootScope, $q) {
        return {
            restrict: 'A',
            replace: true,
            link: function(scope, el, attrs) {

                var fn = function(elem) {
                    if (elem.requestFullscreen) {
                        elem.requestFullscreen();
                    } else if (elem.msRequestFullscreen) {
                        elem.msRequestFullscreen();
                    } else if (elem.mozRequestFullScreen) {
                        elem.mozRequestFullScreen();
                    } else if (elem.webkitRequestFullscreen) {
                        elem.webkitRequestFullscreen();
                    }
                };
                scope.enterFullScreen = function() {
                    fn(document.documentElement);
                    angular.element(el).remove();
                };
                scope.cancel = function(arguments) {
                    angular.element(el).remove();
                };


            },
            templateUrl: 'partials/tool/fullScreenModal.html'
        };
    }]);

});
